Every document has an identifier field _id
. The identifier field serves as the primary key for the document and can be either auto-generated or custom-assigned.
_id
field:
Document Identification | The document _id field serves as the primary key identifying the document in Ditto. |
---|---|
Customizable Identifier: | If preferred, you can customize the _id as a string or JSON‑object. (See Custom Document Identifier) |
**Retrieval by **_id | You can fetch a document by its identifier. For more information, see Fetching a Document by _id . |
_id
field.
123
.
_id
to a JSON object when inserting a new document.
The following snippet demonstrates combining the vin
and make
fields to form a composite key:
_id
):